//
//  PostcidRequest.m
//  TNS
//
//  Created by parkin on 16/2/26.
//  Copyright © 2016年 zhongyan. All rights reserved.
//

#import "PostcidRequest.h"

@interface PostcidRequest ()
@property (nonatomic,strong) NSString *username;
@property (nonatomic,strong) NSString *cid;
@property (nonatomic,strong) NSString *type;
@end

@implementation PostcidRequest

- (instancetype)initWithUserName:(NSString *)username Cid:(NSString *)cid Type:(NSString *)type {
    if (self) {
        self.username = username;
        self.cid = cid;
        self.type = @"ios";
    }
    return self;
}

- (NSString *)getRequestURL {
    NSString * baseUrl = @"http://122.226.73.41:81/api/saveUser/";
    NSString *url = [NSString stringWithFormat:@"%@",baseUrl];
    return url;
}
- (RequestMethodType)getRequestMethod {
    return PostMethod;
}
- (id)getRequestParams {
    NSMutableDictionary * paramDict = [super getRequestParams];
    if (self.username) {
        paramDict[@"user"] = self.username;
//        [paramDict setObject:self.username forKeyedSubscript:@"user"];
    }
    if (self.cid) {
        paramDict[@"cid"] = self.cid;
//        [paramDict setObject:self.cid forKeyedSubscript:@"cid"];
    }
    if (self.type) {
        paramDict[@"type"] = self.type;
//        [paramDict setObject:self.type forKeyedSubscript:@"type"];
    }
    return [NSString stringWithFormat:@"user=%@&cid=%@&type=%@",self.username,self.cid,self.type];;
}

@end
